package com.qf.flash.mvp.presenter;

import com.qf.dblib.dao.impl.UserMgr;
import com.qf.flash.http.HttpManager;
import com.qf.flash.model.RewardInfoBean;
import com.qf.flash.mvp.contract.AbilityContract;
import com.qf.flashlib.base.BasePresenter;
import com.qf.flashlib.base.BaseSubscriber;
import com.qf.flashlib.util.RxUtils;

public class AbilityPresenter extends BasePresenter<AbilityContract.View> implements AbilityContract.Presenter {
    @Override
    public void getRankRewardInfo() {
        String uid = UserMgr.getInstance().getLoginUser().getUid();
        addSubscription(HttpManager.getInstance().getGsonHttpApi()
                .GET_RANK_REWARD_INFO(uid)
                .compose(RxUtils.handleResult())
                .compose(RxUtils.io_main())
                .subscribeWith(new BaseSubscriber<RewardInfoBean>(mRootView) {
                                   @Override
                                   public void onSuccess(RewardInfoBean infoBean) {
                                       mRootView.setRankRewardInfo(infoBean);
                                   }
                               }
                )
        );
    }
}
